﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Dazaza.Domain.Model;
using Dazaza.Domain.Model.SearchInfo;
using Dazaza.Framework.Data;

namespace Dazaza.Repositories
{
    /// <summary>
    /// dbo.[users]
    /// </summary>
    public class UserRepository
    {
        /// <summary>
        /// 获取一个用户信息
        /// [users] index:name
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static UserModel GetUser(string name)
        {
            string sql = "select top 1 * from [users] with(nolock) where name = @name";

            DataCommand dc = new DataCommand(sql, CommandType.Text, DataBaseType.Main);
            dc.SetParameterValue("@name", SqlDbType.NVarChar, name);

            return dc.ExecuteEntity<UserModel>();
                 
        }
    }
}
